import React, {Component} from 'react';
import Detail from "./Detail";
import {Link,Route} from "react-router-dom";

class Message extends Component {
    state={
        message:[
            {id:"01",message: "消息1"},
            {id:"02",message: "消息2"},
            {id:"03",message: "消息3"}
        ]
    }
    render() {
        return (
            <div>
                <div>
                    <ul>
                        {
                            this.state.message.map((item)=>{
                                return ( <li key={item.id}>
                                    <Link replace={true} to={{pathname:'/home/message/detail',state:{id:item.id,message:item.message}}}>{item.message}</Link>&nbsp;&nbsp;
                                </li>)
                            })
                        }
                    </ul>
                </div>
               <Route  path="/home/message/detail/" component={Detail}></Route>
            </div>
        );
    }
}


export default Message;